/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.transas.zorlog.data;

/**
 *
 * @author amalikov
 */
public class LowPassFilter implements Modificator {

	public LowPassFilter(double alpha) {
		this.alpha = alpha;
		initialized = false;
	}

	@Override
	public double get(double v) {
		if (initialized)
			value = alpha * v + (1 - alpha) * value;
		else {
			value = v;
			initialized = true;
		}
		return value;
	}
	final double alpha;
	private double value;
	private boolean initialized;
	
}
